package com.sunyard.pcc.common.constant;

/**
 * @Author: Hewei
 * @Description: 评论及回复状态对应Enum
 * @Date: Created in 10:48 2018/1/23
 */
public enum UserStatusEnum {
    NORMAL(0, "正常"),
    DELETED(1, "禁用");

    private Integer code;
    private String message;

    UserStatusEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }


    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }


    /**
     * 根据code获取对应枚举类
     * @param code
     * @return
     */
    public static UserStatusEnum getEnumByCode(Integer code){
        for (UserStatusEnum e : UserStatusEnum.values()){
            if (e.getCode().equals(code)){
                return e;
            }
        }

        return null;
    }
}
